<#compress>
<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>挂失</title>
	<#include "include.ftl"/>

    <style>

        .cation {
            -webkit-box-sizing: border-box;
            margin-bottom: 5px
        }

        address, blockquote, dl, fieldset, figure, hr, ol, p, pre, ul {
            margin: 0;
        }

        .list {
            list-style: none;
            padding: 5px;
        }

        .list2 {
            padding: 5px;
        }

        ul li {
            border-bottom: 1px solid #D4D4D4;
            padding: .8em;
        }

        ul .content {
            float: right;
            margin-right: 5px;
        }

    </style>
</head>
<body>
<div style="padding: 5px 5px 0 5px;;">
    <div class="am-panel am-panel-default cation" >
        <ul class="list">
            <li>
                <span><strong>卡钱包余额:</strong><span class="content">${command.ebagbalance/100}</span></span>
            </li>
            <li>
                <span><strong>未领取余额:</strong><span class="content">${(command.tmpbalance+command.pretmpbalance)/100}</span></span>
            </li>
            <li style="border-bottom: none">
                <span><strong>卡状态:</strong><span class="content" id="status"></span></span>
            </li>
        </ul>
    </div>
    <div class="am-panel am-panel-default cation" style="padding-bottom: 15px">
        <ul class="list2">
            <li>
                <span style="height: 1.2em">
                    <strong style="float: left;line-height:2">查询密码:</strong>
                    <span class="content" style="float: left;width: 65%;margin-left: 5%">
                        <input name="password" style="width: 100%;background: transparent;border: none;border-radius:0;transition:none"
                               class="am-form-field" type="password" onkeyup="if(/\D/.test(this.value)){this.value='';}" oninput="if(value.length>6)value=value.slice(0,6)" maxlength="6" pattern="[0-9]*" placeholder="请输入一卡通查询密码">
                    </span>
                </span>

            </li>
        </ul>
        <button type="button" style="margin-top: 1rem;width: 90%;margin-left: 5%" id="gs_btn" onclick="disabledClick(this,'01')" data-am-loading="{spinner: 'circle-o-notch', loadingText: '加载中...'}" class="am-btn  am-round am-btn-warning">确 认 挂 失</button>
        <button type="button" style="margin-top: 1rem;width: 90%;margin-left: 5%" id="jg_btn" onclick="disabledClick(this,'02')" data-am-loading="{spinner: 'circle-o-notch', loadingText: '加载中...'}" class="am-btn  am-round am-btn-success">确 认 解 挂</button>

        <#--<#if cardInfo.status=='00'>-->
            <#--<button style="margin-top: 1rem;width: 90%;margin-left: 5%" type="button" onclick="disabledClick('01')" class="am-btn am-btn-warning am-radius am-btn-lg am-btn-block">确认挂失</button>-->
        <#--<#elseif cardInfo.status=='01'>-->
            <#--<button style="margin-top: 1rem;width: 90%;margin-left: 5%" type="button" onclick="disabledClick('02')" class="am-btn am-btn-warning am-radius am-btn-lg am-btn-block">确认解挂</button>-->
        <#--</#if>-->
        <#--<button style="margin-top: 1rem;width: 90%;margin-left: 5%" type="button" onclick="javascript:history.back();" class="am-btn am-btn-success am-radius am-btn-lg am-btn-block">返回</button>-->
    </div>


</div>
<script>
	var status='${command.status}';
	var status_des={
	    '00':'正常',
	    '01':'挂失',
	    '02':'冻结',
	    '03':'挂失冻结'
	}
	function refresh_current(st) {
        $('#status').html(status_des[st]);
        if(st=='00'){
            $('#gs_btn').show();
        }else if(st=='01'){
            $('#jg_btn').show();
        }
        $('input[name=password]').val('');
    }
	$(function () {
        refresh_current(status);
    });

    function disabledClick(btn,status) {
        var password=$('input[name=password]').val();
        if(!password){
            alertError('请输入一卡通查询密码');
            return;
        }
        $(btn).button('loading');
        post('api/${api_prefix}/one_card_gsjg?plat=001&access_token=${RequestParameters["access_token"]}',{status:status,password:password},function (result) {
            if(result.code==0){
                if(status=='01'){
                    refresh_current('01');
				}else if(status=='02'){
                    refresh_current('00');
				}
                alertError('操作成功');
            }else{
                alertError(result.message);
            }
            $(btn).button('reset');
        });
    }
</script>
</body>

</html>
</#compress>